import {useStore, mapState} from "vuex";
import { computed } from "vue";
export default function useState(mapper) {
  const store = useStore();
  const statefnsObj = mapState(mapper);
  const newState = {};
  Object.keys(statefnsObj).forEach((key) => {
    newState[key] = computed(statefnsObj[key].bind({$store: store}));
  })
  return newState;
}